'use strict';
app.filter('agentBankCardInfoFilter', ['$sce', function($sce) {
    return function (info) {
        var results = info.split(",");
        info = '';
        for(var i in results) {
            var result = results[i];
            switch (i) {
                case '0':
                    info += '银行: ' + result;
                    break;
                case '1':
                    info += '<br/>卡号:' + result;
                    break;
                case '2':
                    info += '<br/>支行:' + result;
                    break;
                case '3':
                    info += '<br/>姓名:' + result;
                    break;
            }
        }
        return $sce.trustAsHtml(info);
    }
}]);

app.filter('agentWithdrawalsTimeFilter', ['$sce', '$filter', function($sce, $filter) {
    return function (withdrawalsRecord) {
        var times = '申请时间: '+ $filter('date')(withdrawalsRecord.createdTime, 'yyyy-MM-dd HH:mm:ss');
        if(withdrawalsRecord.auditTime) {
            times += '<br/>审核时间: '+ $filter('date')(withdrawalsRecord.auditTime, 'yyyy-MM-dd HH:mm:ss');
        }
        if(withdrawalsRecord.resultTime) {
            switch (withdrawalsRecord.status) {
                case 2:
                    times += '<br/>失败时间: '+ $filter('date')(withdrawalsRecord.resultTime, 'yyyy-MM-dd HH:mm:ss');
                    break;
                case 3:
                    times += '<br/>成功时间: '+ $filter('date')(withdrawalsRecord.resultTime, 'yyyy-MM-dd HH:mm:ss');
                    break;
            }
        }
        return $sce.trustAsHtml(times);
    }
}]);